package com.xl98.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.xl98.entity.Comment;
import com.xl98.mapper.CommentMapper;
import com.xl98.service.CommentService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author ls
 * @since 2020-05-22
 */
@Service
public class CommentServiceImpl extends ServiceImpl<CommentMapper, Comment> implements CommentService {
   @Autowired
    private CommentMapper commentMapper;
    @Override
    public int addComment(Comment comment) {
        return commentMapper.insert(comment);
    }

    @Override
    public List<Comment> findCommentByarticleId(Map<String, String> map) {
        return commentMapper.findCommentByarticleId(map);
    }

    @Override
    public int updateCount(Map<String, String> map) {
        return commentMapper.updateCount(map);
    }

    @Override
    public boolean delete(String id) {
        if(commentMapper.deleteById(id)>0){
            return true;
        }
        return false;
    }


}
